﻿using Ecommerce.API.Application.Command.RoleCommand;
using Ecommerce.Domain.User;
using Ecommerce.Services.User;
using MediatR;

namespace Ecommerce.API.Application.CommandHandlers.RoleHandler
{
    public class AccountIdCommandHandler : IRequestHandler<AccountIdCommand, List<Account>>
    {
        private readonly IUseInfoServices services;

        public AccountIdCommandHandler(IUseInfoServices services)
        {
            this.services = services;
        }

        public async Task<List<Account>> Handle(AccountIdCommand request, CancellationToken cancellationToken)
        {
            return await services.GetNameUser(request.Name);
        }
    }
}
